
<template>
  <el-select v-model="czKeyId" size="small" style="width:100%" filterable clearable @change="returnChange" placeholder="请选择材质" >
    <el-option 
      v-for="item in czList" 
      :key="item.czId" 
      :label="item.czName" 
      :value="item.czId">
    </el-option>
  </el-select>
</template>

<script>
import { listCaizhi } from "@/api/erp/system/caizhi";

export default {
  data() {
    return {
      czList : [],
      czKeyId : '',
    };
  },
  model:{
    prop:'czId',
    event: 'change'
  },
  watch:{
    czId : function(newValue, oldValue){
      this.czKeyId = newValue;
    }
  },
  props: {
    czId: 0,
  },
  methods: {
    returnChange(){
      this.$emit('change', this.czKeyId);
    },
  },
  created() {
      listCaizhi().then((response) => {
          this.czList = response.rows;
      });
  },
};
</script>
